<div class="menu_site">
    <ul class="main_menu">
        <?php
        $index = 1;$showParent = false;
        $cateId = 0;
        $arrParam = Fpt_Global::getParentParams();
        
        $controller = $arrParam['controller'];
        if($this->categoryID == 0){
            if($controller == 'photo'){
                $this->categoryID = CATE_ID_PHOTO;
            }
        }
        echo '<li ' . ($this->categoryID == 0 ? 'class="active"' : '') . '><a href="' . SITE_URL . '" class="parent_menu" title="Trang chủ" alt="Trang chủ">Trang chủ</a></li>';
        $showLastestNews = false;
        foreach ($this->arrMenu as $k => $arrMenu) {//print_r($arrMenu);die();
            $boolActive = ($k == $this->categoryID || $k == $this->parentCategoryID);
            if ($boolActive) {
                $cateId = $arrMenu['category_id'];
                $cateCode = $arrMenu['catecode'];
                $cateType = $arrMenu['cate_type'];
                echo '<li class="active"><a href="' . $this->categoryurl($arrMenu['catecode']) . '" class="parent_menu">' . $arrMenu['catename'] . '</a>';
            } else {
                echo '<li><a class="parent_menu" href="' . $this->categoryurl($arrMenu['catecode']) . '">' . $arrMenu['catename'] . '</a>';
            }
            echo '<div class="menu_site_sub" id="menu_tab' . ($index++) . '"><ul class="main_menu_sub">';
            if ($arrMenu['cate_type'] == 1 && !empty($arrMenu['child'])) {
                $arrSubCate = $arrMenu['child'];
                 if(count($arrSubCate) > 5){
                    $arrSubCate = array_slice($arrSubCate, 0, 5);
                }
                foreach ($arrSubCate as $ks => $arrSubMenu) {
                    if ($arrSubMenu['category_id'] == $this->categoryID || $arrSubMenu['category_id'] == $this->parentCategoryID) {
                        echo '<li class="active"><a href="' . $this->categoryurl($arrSubMenu['catecode'], $arrMenu['catecode']) . '">' . $arrSubMenu['catename'] . '</a></li>';
                    } else {
                        echo '<li><a href="' . $this->categoryurl($arrSubMenu['catecode'], $arrMenu['catecode']) . '">' . $arrSubMenu['catename'] . '</a></li>';
                    }
                }
            }
            echo '</ul></div></li>';
        }
        if($this->controller =='index'){
            $showLastestNews = true;
        }
        ?>
    </ul>
</div>
<div class="sub_title_menu">
    <div id="search_bar">
        <form id="search" target="_blank" method="get" action="http://timkiem.vnexpress.net/the-thao">
            <input type="text" class="w190 txt_search" maxlength="80" value="" name="q">
            <input type="submit" class="btn_search" value="">
        </form>
    </div>
    
    <?php if($showLastestNews) { 
        $modelNews = News::getInstance();
        $arrArticleNews = $modelNews->getListArticleByTime(SITE_ID, 1, 0);
        
        if(!empty($arrArticleNews) && count($arrArticleNews['data']) > 0)
        {
            $articleDetail = $modelNews->getDetailArticleByIDs(array($arrArticleNews['data'][0]));
            $articleDetail = $articleDetail[$arrArticleNews['data'][0]];
            if(!empty($articleDetail)){
            ?>
            <div class="txt_news" style="display:block;"> 
                <a class="txt_black_hover_blue" title="<?php echo $articleDetail["title"]; ?>" alt="<?php echo $articleDetail["title"]; ?>" 
                   href="<?php  echo $this->Articleurl($articleDetail); ?>"><?php echo $articleDetail['title']; ?>
                </a> - <span class="txt_gray"><?php echo $this->DateTimeFormat($articleDetail["public_time"]); ?></span> 
            </div> 
            <div class="new_breakumb_portal">
                <ul>
                    <li class="cap1"><a href="<?php echo SITE_URL; ?>">Thể thao <span class="icon_beta">&nbsp;</span></a></li>
                </ul>
            </div>
            <?php
        }}
    ?>
    <?php } else {?>
    <!--<div class="txt_news" style="display:none;"></div>-->
    <div class="new_breakumb_portal">
        <ul>
            <li class="have_more cap1"><a href="<?php echo SITE_URL; ?>">Thể thao <span class="icon_beta">&nbsp;</span></a></li>
            <?php
            $cateInstance = Category::getInstance();
                $strParentCode = "";
                $arrBreakcumbLevel2 = '';
                if($controller == 'newsmore')
                {
                    $arrBreakcumbLevel2[] = '<li class="cap2"><a class="txt_gray" href="" title="Xem thêm">Xem thêm</a></li>';
                }
                if($controller == 'ranking')
                {
                    $arrBreakcumbLevel2[] = '<li class="cap2"><a class="txt_gray" href="" title="Bảng xếp hạng">Bảng xếp hạng</a></li>';
                }
                if($controller == 'tagnews')
                {
                    $arrBreakcumbLevel2[] = '<li class="cap2"><a class="txt_gray" href="" title="Tags">Tags</a></li>';
                }
                //echo '<pre>';print_r($arrBreakcumbLevel2);die;
                if(isset($this->categoryID) && $this->categoryID > 0){
                    if(isset($this->parentCategoryID) && $this->parentCategoryID > 0){
                        $arrCatInfo = $cateInstance->getCategoryByID($this->parentCategoryID);
                        if(!empty($arrCatInfo)){
                            $strParentCode = $arrCatInfo['catecode'];
                            $arrBreakcumbLevel2[] = '<li class="have_more cap2"><a class="txt_gray" href="' . $this->categoryurl($arrCatInfo['catecode']). '" title="' . $arrCatInfo['catename'] . '">'. $arrCatInfo['catename'] . '</a></li>';
                        }
                    }
                    $arrCatInfo = $cateInstance->getCategoryByID($this->categoryID);
                    if(!empty($arrCatInfo)){
                        if(isset($arrBreakcumbLevel2) && $arrBreakcumbLevel2=="") { $showParent = true; $class = 'cap2';} else { $showParent = false; $class = 'cap3';}
                         $arrBreakcumbLevel2[] = '<li class="'.$class.'"><a class="txt_gray" href="' . $this->categoryurl($arrCatInfo['catecode'], $strParentCode). '" title="' . $arrCatInfo['catename'] . '" alt="' . $arrCatInfo['catename'] . '">'. $arrCatInfo['catename'] . '</a></li>';
                    }
                }
                //echo join('&nbsp; &raquo;', $arrBreakcumb);
                if(!empty($arrBreakcumbLevel2)){
                    echo join($arrBreakcumbLevel2);
                }
                $arrCate = $cateInstance->getCategoryByParentID($cateId);
            ?>
        </ul>
        <ul class="more_sub">
            <?php
            if($showParent && $cateType != 2 && $cateType != 3)
            {
                if(count($arrCate) > 5){
                    $arrCate = array_slice($arrCate, 0, 5);
                }
                $lastCate = array_pop($arrCate);
                foreach($arrCate as $cate)
                {
                ?>
                <li><a href="<?php echo $this->categoryurl($cate['catecode'],$cateCode);?>" class="txt_black_hover_blue"><?php echo $cate['catename'];?></a>  | </li>
                <?php
                }
                ?>
                <li><a href="<?php echo $this->categoryurl($lastCate['catecode'],$cateCode);?>" class="txt_black_hover_blue"><?php echo $lastCate['catename'];?></a></li>
                <?php
            }
            ?>
        </ul>
    </div>
    <?php }?>
</div>
<script language="javascript" type="text/javascript" src="<?php echo $this->config['js']; ?>/menu.js"></script>